<%	
	myValue = InjectRemove(Trim(Request.QueryString("value")))
	myRate = InjectRemove(Trim(Request.QueryString("rate")))
	myGSTPrice = InjectRemove(Trim(Request.QueryString("gstprice")))
	myGSTAmount = InjectRemove(Trim(Request.QueryString("gstamount")))
	myField = InjectRemove(Trim(Request.QueryString("field")))
	
	If (myField = "original") Then
		Response.Write CalculateGST(myValue,myRate,"original")
	ElseIf (myField = "after_gst") Then
		Response.Write CalculateGST(myValue,myRate,"after_gst")
	ElseIf (myField = "gst_tax") Then
		Response.Write CalculateGST(myValue,myRate,"gst_tax")
	ElseIf (myField = "tax_rate") Then
		Response.Write CalculateGST(myValue,myRate,"tax_rate")
	End If

'=============================   ###############################
Function CalculateGST(ByVal myValue, ByVal myRate, ByVal myField)
	myReturn = "0|0"
	If (myField = "original") Then
		If isNumeric(myValue) And isNumeric(myRate) Then
			Value1 = (myValue * myRate) / 100
			Value2 = myValue + Value1
			
			myReturn = FormatNumber(Value1,2) & "|" & FormatNumber(Value2,2)
		End If
	ElseIf (myField = "after_gst") Then
		If isNumeric(myValue) And isNumeric(myRate) Then
			Value1 = myValue / (1 + (myRate / 100.0))
			Value2 = myValue - Value1
			
			myReturn = FormatNumber(Value1,2) & "|" & FormatNumber(Value2,2)
		End If
	
	ElseIf (myField = "gst_tax") Then
		If isNumeric(myValue) And isNumeric(myRate) Then
			Value1 = (myValue / myRate) * 100
			Value2 = myValue + Value1
			
			myReturn = FormatNumber(Value1,2) & "|" & FormatNumber(Value2,2)
		End If
		
	ElseIf (myField = "tax_rate") Then
		If isNumeric(myValue) And isNumeric(myRate) Then
			Value1 = (myValue * myRate) / 100
			Value2 = myValue + Value1
			
			myReturn = FormatNumber(Value1,2) & "|" & FormatNumber(Value2,2)
		End If
		
	End If
	
	CalculateGST = myReturn
End Function

Function InjectRemove(ByVal TheString)
	myReturn = ""
	myReturn = Replace(TheString,"'","")
	myReturn = Replace(myReturn,"\","")
	InjectRemove = myReturn
End Function
%>